// Title  router.go
// Description  路由配置
// Author  alittlexincan@163.com  2024/07/22 11:36
// update  alittlexincan@163.com  2024/07/22 11:36

package router

import (
	"github.com/gorilla/mux"
	_ "github.com/swaggo/http-swagger"
	user "xincan.com.cn/tarot-go-framework/business/user/handler"
)

// Router
// Title    		Router
// Description   	系统路由列表配置
// Auth      		alittlexincan@163.com         	"时间（2024/07/22 11:36）"
// Return    		*mux.Router     				"返回路由对象"
func Router() *mux.Router {
	builder := NewRouteBuilder(mux.NewRouter())
	builder.Swagger("/docs", "./docs")

	ceph := builder.Prefix("/tarot")

	// 集群信息管理
	ceph.Prefix("/user").
		POST("", user.CreateUserHandler()).
		GET("", user.SearchUserListHandler())

	//_ = builder.baseRouter.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error {
	//	path, _ := route.GetPathTemplate()
	//	methods, _ := route.GetMethods()
	//	fmt.Printf("路由: %-6s %s\n", strings.Join(methods, ","), path)
	//	return nil
	//})
	return builder.baseRouter
}
